#!/usr/bin/python
# -*- coding: utf-8 -*-

'''
参考: http://www.sqlalchemy.org/docs/core/pooling.html
'''

__author__ = 'lyj'

import sqlalchemy.pool as pool
import MySQLdb as mysql

# manage(creater, pool_size=5, max_overflow=10, timeout=30, **kw)
# creater - 符合 DB-API 2.0 的数据模块，如MySQLdb、SQLObject等
mysql = pool.manage(mysql, pool_size=5, max_overflow=10, timeout=30)

# then connect normally
connection = mysql.connect(db='test',
                           user='root',
                           passwd='',
                           host='127.0.0.1',
                           port=3306,
                           charset='utf8',
                           unix_socket='127.0.0.1',
                           init_command='set wait_timeout = 300;')
print connection


if __name__ == '__main__':
    pass  